import { ApiProperty } from '@nestjs/swagger';
import { IsString, IsNumber, IsDateString, IsEnum, IsOptional, Min, Max, IsArray } from 'class-validator';

export enum FeeMode {
  FREE = 'FREE',      // 免费
  PAID = 'PAID',      // 收费
  DEPOSIT = 'DEPOSIT' // 押金
}

export enum DifficultyLevel {
  EASY = 'EASY',     // 简单
  MEDIUM = 'MEDIUM', // 中等
  HARD = 'HARD'      // 困难
}

export class CreateActivityDto {
  @ApiProperty({ 
    description: '活动标题',
    example: '西湖环湖骑行',
    required: true 
  })
  @IsString()
  title: string;

  @ApiProperty({ 
    description: '活动描述',
    example: '环绕西湖骑行，欣赏美景',
    required: true 
  })
  @IsString()
  description: string;

  @ApiProperty({ 
    description: '活动类型',
    example: '休闲骑行',
    required: true 
  })
  @IsString()
  type: string;

  @ApiProperty({ 
    description: '活动起点',
    example: '杭州市西湖区断桥',
    required: true 
  })
  @IsString()
  startLocation: string;

  @ApiProperty({ 
    description: '活动终点',
    example: '杭州市西湖区雷峰塔',
    required: true 
  })
  @IsString()
  endLocation: string;

  @ApiProperty({ 
    description: '开始时间',
    example: '2024-01-20T09:00:00Z',
    required: true 
  })
  @IsDateString()
  startTime: string;

  @ApiProperty({ 
    description: '结束时间',
    example: '2024-01-20T17:00:00Z',
    required: true 
  })
  @IsDateString()
  endTime: string;

  @ApiProperty({ 
    description: '路线说明',
    example: '从断桥出发，沿着西湖北线骑行，经过...',
    required: true 
  })
  @IsString()
  routeDescription: string;

  @ApiProperty({ 
    description: '最大参与人数',
    example: 20,
    minimum: 1,
    required: true 
  })
  @IsNumber()
  @Min(1)
  maxParticipants: number;

  @ApiProperty({ 
    description: '最小参与人数',
    example: 5,
    minimum: 1,
    required: true 
  })
  @IsNumber()
  @Min(1)
  minParticipants: number;

  @ApiProperty({ 
    description: '收费模式',
    enum: FeeMode,
    example: FeeMode.FREE,
    required: true 
  })
  @IsEnum(FeeMode)
  feeMode: FeeMode;

  @ApiProperty({ 
    description: '费用金额',
    example: 50,
    minimum: 0,
    required: false,
    nullable: true 
  })
  @IsOptional()
  @IsNumber()
  @Min(0)
  feeAmount?: number;

  @ApiProperty({ 
    description: '押金金额',
    example: 100,
    minimum: 0,
    required: false,
    nullable: true 
  })
  @IsOptional()
  @IsNumber()
  @Min(0)
  depositAmount?: number;

  @ApiProperty({ 
    description: '费用说明',
    example: '费用包含保险和补给',
    required: true 
  })
  @IsString()
  feeDescription: string;

  @ApiProperty({ 
    description: '难度等级',
    enum: DifficultyLevel,
    example: DifficultyLevel.MEDIUM,
    required: true 
  })
  @IsEnum(DifficultyLevel)
  difficultyLevel: DifficultyLevel;

  @ApiProperty({ 
    description: '参与要求',
    example: '需要自备自行车，建议有一定骑行经验',
    required: true 
  })
  @IsString()
  requirements: string;

  @ApiProperty({ 
    description: '装备要求',
    example: '自行车、头盔、骑行服、水壶',
    required: true 
  })
  @IsString()
  equipmentRequired: string;

  @ApiProperty({ 
    description: '封面图片URL',
    example: 'https://example.com/images/cover.jpg',
    required: true 
  })
  @IsString()
  cover: string;

  @ApiProperty({ 
    description: '标签',
    example: '休闲骑行',
    required: false,
    nullable: true 
  })
  @IsOptional()
  @IsString()
  tag?: string;
}




